package main

import (
	"fmt"
)

func shortestCompletingWord(licensePlate string, words []string) string {
	licens := [26]int{}
	for _, value := range licensePlate {
		if 'a' <= value && value <= 'z' {
			licens[value-'a']++
		} else if 'A' <= value && value <= 'Z' {
			licens[value-'A']++
		}
	}

	var res string
	for _, word := range words {
		array := [26]int{}
		for _, v := range word {
			array[v-'a']++
		}
		full := true
		for index, v2 := range licens {
			if v2 > array[index] {
				full = false
				break
			}
		}
		if full {
			if res == "" || len(word) < len(res) {
				res = word
			}
		}
	}
	return res
}

func main() {
	arr1 := [4]string{"step", "steps", "stripe", "stepple"}
	fmt.Println(shortestCompletingWord("1s3 PSt", arr1[:]))
}
